package io.xccit.oshiapp.common.r;

import lombok.Builder;
import lombok.Data;
import lombok.ToString;

/**
 * @author CH_ywx
 * @version 1.0
 * @create 2024/12/14
 * <p>全局返回对象</p>
 */
@Data
@Builder
@ToString
public class AjaxResult {
    private Integer code;
    private String message;
    private Object data;

    public static AjaxResult success(){
        return AjaxResult.builder().code(200).message("操作成功").build();
    }
    public static AjaxResult success(Object data){
        return AjaxResult.builder().code(200).message("操作成功").data(data).build();
    }
    public static AjaxResult fail(){
        return AjaxResult.builder().code(500).message("操作失败").build();
    }
    public static AjaxResult fail(String message){
        return AjaxResult.builder().code(500).message(message).build();
    }
}
